#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

#define FILE_NAME "soo.txt"
int main()
{
//  close(0);
//close(2);
//close(1);
//  umask(0);
  int fd=open(FILE_NAME,O_RDONLY,0666);
if(fd<0)
{
  perror("open failed");
  return 1;
}
dup2(fd,0);
char arr[64];
while(1)
{
  printf(">");
  if(fgets(arr,sizeof(arr),stdin)==NULL)break;
  printf("%s",arr);
}
//printf("open fd:%d\n",fd);
//fprintf(stdout,"open fd:%d\n",fd);
//fflush(stdout);

  close(fd);
return 0;
  }
